package com.cgc.shop.action;

import java.util.Date;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.cgc.shop.model.Cart;
import com.cgc.shop.model.Status;
import com.cgc.shop.model.User;

@Controller("cartAction")
@Scope("prototype")
public class CartAction extends BaseAction<Cart> {
	
	@Override
	public Cart getModel() {
		model = (Cart) sessionMap.get("cart");
		return model;
	}
	public String save() {
		model.setUser((User) sessionMap.get("user"));
		model.setStatus(new Status(1));
		model.setDate(new Date());
		cartService.save(model);
		return "save";
	}
}
